#include "CheckPoint.h"
//#include "Global.h"
#include "Resource.h"

CheckPoint::CheckPoint(LPDIRECT3DDEVICE9 d3ddv, LPDIRECT3DSURFACE9 BackBuffer, LPD3DXSPRITE SpriteHandler, float x, float y, int ID, int Obj_state) : Object(x, y)
{
	this->setIDObjType(ID);
	//_sprite = new Sprite(SpriteHandler, ResourceMng::GetInst(d3ddv, BackBuffer)->GetTexture(L"..\\Resources\\Images\\wallred.png"), 0, 0);
	//_sprite = new Sprite(SpriteHandler, ResourceMng::GetInst(d3ddv, BackBuffer)->GetTexture(L"..\\Resources\\Images\\Gach.png"), 0, 0);
	p_sprite = new Sprite(SpriteHandler, ResourceMng::GetInst(d3ddv, BackBuffer)->GetTexture(L"..\\Resources\\Images\\star.png"), 125, 0);
	//_sprite->SetFrame(4,4);
	//ResetRect();

	width = p_sprite->getTexture()->getWidth();
	height = p_sprite->getTexture()->getHeight();

	this->obj_state = Obj_state;
	direction = 0;
}

CheckPoint::~CheckPoint()
{
	/*if (_sprite != NULL)
	{
		delete _sprite;
	}*/
}

 

void CheckPoint::render(int cameraX, int cameraY)
{
	//Object::Draw(spriteHandler);
	/*float x = this->m_pos.x;
	float y = m_pos.y;*/
	//_sprite->SetFrame(0,1);
	//_sprite->SetFrame(4,4);
	//ResetRect();
	p_sprite->render(pos_x, pos_y, cameraX, cameraY);
}

OBJECT_TYPE CheckPoint::getObjectType()
{
	return OBJECT_LAND;
}

//void CheckPoint::ResetRect()
//{
//	_rectBond.left = _x;
//	_rectBond.right = _rectBond.left + _sprite->texture->_Width;
//	_rectBond.top = _y;
//	_rectBond.bottom = _rectBond.top + _sprite->texture->_Height;
//}

void CheckPoint::update(list<Object*>* obj_list, DxInput* input, float TPF)
{
	
	//_sprite->Update(gameTime);
	Object::update(obj_list, input, TPF);
	
	//ResetRect();
}